from rest_framework import  serializers
from .models import Area
##
#上级行政区域信息
class AreaInfoSerializer(serializers.ModelSerializer):
    class Meta:
        model = Area
        fields = ("id","name")

#子级行政区域信息
class AreaSubsInfoSerializer(serializers.ModelSerializer):
    subs = AreaInfoSerializer(read_only=True,many=True)
    class Meta:
        model = Area
        fields = ("id","name","subs")